﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using KPIS.GERP.GHRMS.BLL;
using KPIS.GERP.GHRMS.IBLL;
using Telerik.Web.UI;
using System.Globalization;

namespace KPIS.GERP.GHRMS.APP.App_UI.Forms
{
    public partial class DC_Crimes : System.Web.UI.Page
    {
        SsMng ssMng = new SsMng();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadDataGrid();
            }
        }
     
        private void LoadDataGrid()
        {
            try
            {
                CrimesBLL obj = new CrimesBLL();                 
                DataTable dt = null;
                dt = obj.Select(); 

                RadGrid2.DataSource = dt;
                RadGrid2.DataBind();
            }
            catch (Exception ex)
            {

            }
        }

        protected void RadGrid2_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            if (e.CommandName == "Delete" && e.Item as GridDataItem != null)
            {
                var item = e.Item as GridDataItem;
                int seq = Convert.ToInt32((item).OwnerTableView.DataKeyValues[e.Item.ItemIndex]["cr_seq"]);
               // salaryCommandBLL.Delete(seq, ssMng.EmpSeq);
                CrimesBLL obj = new CrimesBLL();
                obj.Delete(seq, 1); 
            }
            LoadDataGrid();
        }

        protected void RadGrid2_ItemDataBound(object sender, GridItemEventArgs e)
        {

        }

        protected void RadGrid2_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {

        }
    }
}
